package com.dwh.web.controller;

import cn.hutool.core.collection.CollUtil;
import com.surfilter.exception.annotation.ResponseResult;
import com.surfilter.exception.entity.Result;
import com.dwh.web.pojo.CarInfo;
import com.dwh.web.pojo.JnWaSyfwYq;
import com.dwh.web.pojo.JnWaSyrkYq;
import com.dwh.web.pojo.User;
import com.dwh.web.service.JnWaSyfwYqService;
import com.dwh.web.service.JnWaSyrkYqService;
import com.dwh.web.service.SecontService;
import com.dwh.web.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("aaa")
public class TestController {


    @Autowired
    UserService userService ;
    @Autowired
    SecontService secontService;
    @Autowired
    JnWaSyfwYqService jnWaSyfwYqService;
    @Autowired
    JnWaSyrkYqService jnWaSyrkYqService;
    @RequestMapping("/aaa")
//    @ResponseResult
    public Result test(String aaa){

        List<User> users = userService.selectUsers(-1);
        List<User> users1 = userService.selectABC();
        List<CarInfo> carInfos = secontService.selectAll();
        // 测试提交
        // 测试提交2
//        List<SYFWYQ> selecta = syfwyqService.selecta();
        Result result = Result.success("asdfa");
        return result;
    }

    @RequestMapping("/aaa1")
    @ResponseResult
    public String test1(String aaa){

        List<User> users = userService.selectUsers(-1);
        List<User> users1 = userService.selectABC();
        List<CarInfo> carInfos = secontService.selectAll();

        List<JnWaSyrkYq> jnWaSyrkYqs = jnWaSyrkYqService.selectBySfzh("3701010");

        if (CollUtil.isNotEmpty(jnWaSyrkYqs)){
            for (JnWaSyrkYq jnWaSyrkYq : jnWaSyrkYqs) {

                List<JnWaSyfwYq> fws = jnWaSyfwYqService.selectByOid(jnWaSyrkYq.getOid());
            }
        }





//        Result result = Result.success("asdfa");
//        try {
//            String aa = null;
//            aa.length();
//        }catch (Exception e){
//            throw e;
//        }

        return "result";
    }

}
